from appium import webdriver
from appium.webdriver.common.appiumby import By
from time import sleep
from zoom import *

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '7'
desired_caps['deviceName'] = '127.0.0.1:62001'
desired_caps['app']=r'D:\tool\apk\GaodeMAP.apk'
desired_caps['appPackage']=r'com.autonavi.minimap'
desired_caps['appActivity']=r'com.autonavi.map.activity.SplashActivity'
desired_caps['noReset']=False

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
driver.implicitly_wait(10)
sleep(3)

#点击同意
driver.find_element(By.ID,'com.autonavi.minimap:id/agree').click()
sleep(2)
#点击进入地图
driver.find_element(By.ID,'com.autonavi.minimap:id/enter_amap').click()
#点击允许
driver.find_element(By.ID,'com.android.packageinstaller:id/permission_allow_button').click()
sleep(1)
driver.find_element(By.ID,'com.android.packageinstaller:id/permission_allow_button').click()
sleep(1)
driver.find_element(By.ID,'com.android.packageinstaller:id/permission_allow_button').click()
sleep(5)

smaller(driver)
sleep(3)
bigger(driver)
sleep(3)
driver.quit()





